<?php
/**
 * Creative
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API for Sponsored Display
 *
 * This API enables programmatic access for campaign creation, management, and reporting for Sponsored Display campaigns. For more information on the functionality, see the [Sponsored Display Support Center](https://advertising.amazon.com/help#GTPPHE6RAWC2C4LZ). For API onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) topic.<br/><br/> > This specification is available for download from the **[Advertising API developer portal](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/sponsored-display/3-0/openapi.yaml).**
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * Creative Class Doc Comment
 *
 * @category Class
 * @description Creative model.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class Creative implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'Creative';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'creative_id' => 'float',
        'ad_group_id' => '\AmazonAdvertisingApi\Model\AdGroupId',
        'creative_type' => '\AmazonAdvertisingApi\Model\CreativeTypeInCreativeResponse',
        'properties' => '\AmazonAdvertisingApi\Model\CreativeProperties',
        'moderation_status' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'creative_id' => null,
        'ad_group_id' => null,
        'creative_type' => null,
        'properties' => null,
        'moderation_status' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'creative_id' => 'creativeId',
        'ad_group_id' => 'adGroupId',
        'creative_type' => 'creativeType',
        'properties' => 'properties',
        'moderation_status' => 'moderationStatus'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'creative_id' => 'setCreativeId',
        'ad_group_id' => 'setAdGroupId',
        'creative_type' => 'setCreativeType',
        'properties' => 'setProperties',
        'moderation_status' => 'setModerationStatus'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'creative_id' => 'getCreativeId',
        'ad_group_id' => 'getAdGroupId',
        'creative_type' => 'getCreativeType',
        'properties' => 'getProperties',
        'moderation_status' => 'getModerationStatus'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const MODERATION_STATUS_APPROVED = 'APPROVED';
    const MODERATION_STATUS_PENDING_REVIEW = 'PENDING_REVIEW';
    const MODERATION_STATUS_REJECTED = 'REJECTED';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getModerationStatusAllowableValues()
    {
        return [
            self::MODERATION_STATUS_APPROVED,
            self::MODERATION_STATUS_PENDING_REVIEW,
            self::MODERATION_STATUS_REJECTED,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['creative_id'] = isset($data['creative_id']) ? $data['creative_id'] : null;
        $this->container['ad_group_id'] = isset($data['ad_group_id']) ? $data['ad_group_id'] : null;
        $this->container['creative_type'] = isset($data['creative_type']) ? $data['creative_type'] : null;
        $this->container['properties'] = isset($data['properties']) ? $data['properties'] : null;
        $this->container['moderation_status'] = isset($data['moderation_status']) ? $data['moderation_status'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['creative_id'] === null) {
            $invalidProperties[] = "'creative_id' can't be null";
        }
        if ($this->container['ad_group_id'] === null) {
            $invalidProperties[] = "'ad_group_id' can't be null";
        }
        if ($this->container['creative_type'] === null) {
            $invalidProperties[] = "'creative_type' can't be null";
        }
        if ($this->container['properties'] === null) {
            $invalidProperties[] = "'properties' can't be null";
        }
        if ($this->container['moderation_status'] === null) {
            $invalidProperties[] = "'moderation_status' can't be null";
        }
        $allowedValues = $this->getModerationStatusAllowableValues();
        if (!is_null($this->container['moderation_status']) && !in_array($this->container['moderation_status'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'moderation_status', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets creative_id
     *
     * @return float
     */
    public function getCreativeId()
    {
        return $this->container['creative_id'];
    }

    /**
     * Sets creative_id
     *
     * @param float $creative_id Unique identifier of the creative.
     *
     * @return $this
     */
    public function setCreativeId($creative_id)
    {
        $this->container['creative_id'] = $creative_id;

        return $this;
    }

    /**
     * Gets ad_group_id
     *
     * @return \AmazonAdvertisingApi\Model\AdGroupId
     */
    public function getAdGroupId()
    {
        return $this->container['ad_group_id'];
    }

    /**
     * Sets ad_group_id
     *
     * @param \AmazonAdvertisingApi\Model\AdGroupId $ad_group_id ad_group_id
     *
     * @return $this
     */
    public function setAdGroupId($ad_group_id)
    {
        $this->container['ad_group_id'] = $ad_group_id;

        return $this;
    }

    /**
     * Gets creative_type
     *
     * @return \AmazonAdvertisingApi\Model\CreativeTypeInCreativeResponse
     */
    public function getCreativeType()
    {
        return $this->container['creative_type'];
    }

    /**
     * Sets creative_type
     *
     * @param \AmazonAdvertisingApi\Model\CreativeTypeInCreativeResponse $creative_type creative_type
     *
     * @return $this
     */
    public function setCreativeType($creative_type)
    {
        $this->container['creative_type'] = $creative_type;

        return $this;
    }

    /**
     * Gets properties
     *
     * @return \AmazonAdvertisingApi\Model\CreativeProperties
     */
    public function getProperties()
    {
        return $this->container['properties'];
    }

    /**
     * Sets properties
     *
     * @param \AmazonAdvertisingApi\Model\CreativeProperties $properties properties
     *
     * @return $this
     */
    public function setProperties($properties)
    {
        $this->container['properties'] = $properties;

        return $this;
    }

    /**
     * Gets moderation_status
     *
     * @return string
     */
    public function getModerationStatus()
    {
        return $this->container['moderation_status'];
    }

    /**
     * Sets moderation_status
     *
     * @param string $moderation_status The moderation status of the creative
     *
     * @return $this
     */
    public function setModerationStatus($moderation_status)
    {
        $allowedValues = $this->getModerationStatusAllowableValues();
        if (!in_array($moderation_status, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'moderation_status', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['moderation_status'] = $moderation_status;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
